import { HttpModule, MiddlewareConsumer, Module, NestModule } from "@nestjs/common";
import { AppController } from "./controller/app.controller";
import { AppService } from "./service/app.service";
import { CatsController } from "./controller/cats.controller";
import { CatsService } from "./service/cats.service";
import { MainWebController } from "./controller/IBaseController/mainWeb.controller";
import { ProxyService } from "./service/proxy.service";
import { CasController } from "./controller/IBaseController/cas.controller";
import { PublicController } from "./controller/IBaseController/public.controller";
import { GdbdcWebController } from "./controller/IBaseController/gdbdcWeb.controller";
import { registerMiddleware } from "./middleRegister";
import { ConfigModule } from "@nestjs/config";
import { PageController } from "./controller/page.controller";

const controllers = [
  AppController,
  PageController,
  CatsController,
  MainWebController,
  CasController,
  PublicController,
  GdbdcWebController,

];

const providers = [
  AppService,
  CatsService,
  ProxyService
];

const imports = [
  HttpModule,
  ConfigModule.forRoot()
];

@Module({
  imports: imports,
  controllers: controllers,
  providers: providers
})
export class AppModule implements NestModule {
  configure(consumer: MiddlewareConsumer): any {
    registerMiddleware(consumer);
  }
}
